<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/page/inc/taglib.jsp" %>
<div class="pageHeader">
    <form id="pagerForm" onsubmit="return navTabSearch(this);"
          action="${pageContext.request.contextPath}/statistics/orders/list" method="post">
        <!-- 分页表单参数 -->
        <%@include file="/WEB-INF/page/inc/pageForm.jsp" %>
        <!-- 需要排序的字段 -->
        <input type="hidden" name="orderField" value="${requestScope.dwzPageBean.countResultMap.orderField}"/>
        <!-- 正序倒序 -->
        <input type="hidden" name="orderDirection" value="${requestScope.dwzPageBean.countResultMap.orderDirection}"/>
        <div class="searchBar">
            <table class="searchContent">
                <tr>
                    <td>导购员：<input type="text" name="employeeName" value="${requestScope.dwzPageBean.countResultMap.employeeName}" placeholder="输入姓名" /></td>
                    <td>店铺：<input type="text" name="shop" value="${requestScope.dwzPageBean.countResultMap.shop}" placeholder="输入店铺名" /></td>
                    <td>
                        <span>时间范围：</span>
                        <input type="text" name="startTime" class="date" placeholder="开始时间" readonly="true" value="<fmt:formatDate value="${requestScope.dwzPageBean.countResultMap.startTime}" pattern="yyyy-MM-dd" />" />
                        <span>～</span>
                        <input type="text" name="endTime" class="date" placeholder="结束时间" readonly="true" value="<fmt:formatDate value="${requestScope.dwzPageBean.countResultMap.endTime}" pattern="yyyy-MM-dd" />" />
                    </td>
                </tr>
            </table>
            <div class="subBar">
                <ul>
                    <li>
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="submit">查询</button>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <shiro:hasPermission name="/statistics/orders/excel">
            <li class=""><a class="icon" href="${pageContext.request.contextPath}/statistics/orders/excel" target="dwzExport" targettype="navTab" title="实要导出这些记录吗?"><span>导出EXCEL</span></a></li>
            </shiro:hasPermission>
        </ul>
    </div>
    <table class="table" targetType="navTab" asc="asc" desc="desc" width="100%" layoutH="138">
        <thead>
        <tr>
            <th width="22"><input type="checkbox" group="id" class="checkboxCtrl"></th>
            <th orderField="o.order_num"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.order_num'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                订单号
            </th>
            <th orderField="o.order_process"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.order_process'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                订单流程
            </th>
            <th orderField="o.order_money"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.order_money'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                订单总额
            </th>
            <th orderField="o.receivable_money"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.receivable_money'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                应收金额
            </th>
            <th orderField="o.real_money"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.real_money'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                实收金额
            </th>
            <th orderField="o.activity_reduce_money"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.activity_reduce_money'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                活动减免金额
            </th>
            <th orderField="o.activity_id"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.activity_id'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                活动
            </th>
            <th orderField="o.order_discount"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.order_discount'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                订单折扣
            </th>
            <th orderField="o.pay_time"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.pay_time'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                支付时间
            </th>

            <%--<th orderField="o.postage_price"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.postage_price'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                快递费
            </th>--%>
            <th orderField="o.member_id"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.member_id'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                会员名称
            </th>
            <%--<th orderField="o.evaluation_state"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.evaluation_state'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                评论状态
            </th>--%>
            <th orderField="o.guider"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.guider'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                导购员
            </th>
            <th orderField="o.shop_id"
                <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'o.shop_id'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>
                店铺
            </th>
        </tr>
        </thead>
        <tbody>

        <c:if test="${requestScope.dwzPageBean != null &&  requestScope.dwzPageBean.recordList != null }">
            <c:forEach var="record" items="${requestScope.dwzPageBean.recordList}" varStatus="status">
                <tr>
                    <td><input name="id" value="${record.orderId}" type="checkbox"></td>
                    <td>${record.orderNum}</td>
                    <!-- 0新订单（未付款）1已受理 2待收货 6退款中 7已退货 8取消订单 9 完成
                    (record.orderProcess==0&&"新订单（未付款）")||(record.orderProcess==1&&"已受理")||(record.orderProcess==2&&"待收货")||(record.orderProcess==6&&"退款中")||(record.orderProcess==7&&"已退货")||(record.orderProcess==8&&"取消订单")||(record.orderProcess==9&&"完成")
                    -->
                    <td>${record.orderProcess==0?"新订单":record.orderProcess==1?"已受理":record.orderProcess==2?"待收货":record.orderProcess==6?"退款中":record.orderProcess==7?"已退货":record.orderProcess==8?"取消订单":record.orderProcess==9?"完成":record.orderProcess}</td>
                    <!-- 即订单不算任何优惠的钱-->
                    <td><fmt:formatNumber value="${record.orderMoney}" pattern="0.0#" /></td>
                    <td><fmt:formatNumber value="${record.receivableMoney}" pattern="0.0#" /></td>
                    <%--即收银员实际收取的金额--%>
                    <td><fmt:formatNumber value="${record.realMoney}" pattern="0.0#" /></td>
                    <%-- (只会参加一个营销活动)--%>
                    <td><fmt:formatNumber value="${record.activityReduceMoney}" pattern="0.0#" /></td>
                    <td>${record.activityName}</td>
                    <td>${record.orderDiscount}%</td>
                    <td><fmt:formatDate value="${record.payTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                    <%--<td>${record.postagePrice}</td>--%>
                    <td>${record.memberName}</td>
                    <%--<td>${record.evaluationState==0?"未评论":"已评论"}</td>--%>

                    <td>${record.guiderName}</td>
                    <td>${record.shopName}</td>

                </tr>
            </c:forEach>
        </c:if>

        </tbody>
    </table>
    <!-- 分页条 -->
    <%@include file="/WEB-INF/page/inc/pageBar.jsp" %>
</div>